<div class="layuimini-container">
    <div class="layuimini-main">

        <form id="app-form" class="layui-form layuimini-form">
            {if condition='empty($company_id)'}
            <div class="layui-form-item">
                <label class="layui-form-label required">用户头像</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="head_img" class="layui-input layui-col-xs6" lay-reqtext="请上传用户头像" placeholder="请上传用户头像" value="{$row.head_img|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="head_img" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg"><i class="fa fa-upload"></i> 上传</a></span>
                        <span><a class="layui-btn layui-btn-normal" id="select_head_img" data-upload-select="head_img" data-upload-number="one"><i class="fa fa-list"></i> 选择</a></span>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">登录账户</label>
                <div class="layui-input-block">
                    <input type="text" name="username" class="layui-input" readonly value="{$row.username|default=''}">
                    <tip>填写登录账户。</tip>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">用户手机</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" class="layui-input" lay-reqtext="请输入用户手机" placeholder="请输入用户手机" value="{$row.username|default=''}">
                    <tip>填写用户手机。</tip>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">备注信息</label>
                <div class="layui-input-block">
                    <textarea name="remark" class="layui-textarea" placeholder="请输入备注信息">{$row.username|default=''}</textarea>
                </div>
            </div>
            {/if}
            {if condition='!empty($company_id)'}
            <div class="layui-form-item">
                <label class="layui-form-label required">类型</label>
                    <div class="layui-input-block" >
                        <input type="radio" name="cur_type" lay-filter="levelM" class="layui-input" value="1" title="企业" {if condition="$row.cur_type eq 1"} checked{/if}>
                        <input type="radio" name="cur_type" lay-filter="levelM" class="layui-input" value="2" title="个人" {if condition="$row.cur_type eq 2"} checked{/if}>
                    </div>
            </div>
            <div class="layui-form-item" id="qiye">
                <label class="layui-form-label required">公司名称</label>
                <div class="layui-input-block">
                    <input type="text" name="company_name" class="layui-input"   placeholder="请输入公司名称" value="{$row.company_name|default=''}">
                </div>
            </div>
            <div class="layui-form-item" id="qiye1">
                <label class="layui-form-label required">营业执照</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="business_license_photo" class="layui-input layui-col-xs6" readonly  placeholder="请上传营业执照" value="{$row.business_license_photo|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="business_license_photo" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="business_license_photo"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
     
            <div class="layui-form-item" id="qiye2">
                <label class="layui-form-label required">公司logo</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="company_logo" class="layui-input layui-col-xs6" readonly  placeholder="请上传公司logo" value="{$row.company_logo|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="company_logo" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="company_logo"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
              
            <div class="layui-form-item" id="geren" style="display: none;">
                <label class="layui-form-label required">身份证人像面</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="identity_card_front" class="layui-input layui-col-xs6" readonly  placeholder="请上传身份证人像面" value="{$row.identity_card_front|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="identity_card_front" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="identity_card_front"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" id="geren1" style="display: none;">
                <label class="layui-form-label required">身份证国徽面</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="identity_card_back" class="layui-input layui-col-xs6" readonly  placeholder="请上传身份证国徽面" value="{$row.identity_card_back|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="identity_card_back" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="identity_card_back"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
           
            <div class="layui-form-item">
                <label class="layui-form-label required">联系人姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="contact_person_name" class="layui-input" lay-verify="required"  placeholder="请输入联系人姓名" value="{$row.contact_person_name|default=''}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">联系人头像</label>
                <div class="layui-input-block layuimini-upload">
                    <input name="contact_person_avatar" class="layui-input layui-col-xs6" readonly lay-verify="required"  placeholder="请上传联系人头像" value="{$row.contact_person_avatar|default=''}">
                    <div class="layuimini-upload-btn">
                        <span><a class="layui-btn" data-upload="contact_person_avatar" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="contact_person_avatar"><i class="fa fa-upload"></i> 上传</a></span>
                    </div>
                </div>
            </div>
    
            <div class="layui-form-item">
                <label class="layui-form-label required">注册账号</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" class="layui-input" lay-verify="required"  placeholder="请输入注册账号" value="{$row.mobile|default=''}">
                </div>
            </div>
            {/if}
            <input type="hidden" id="type" value="{$row.cur_type}">
            <div class="hr-line"></div>
            <div class="layui-form-item text-center">
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
                <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
            </div>

        </form>

    </div>
</div>
<script type="text/javascript">
    layui.use(['form','upload'], function(){
        var form = layui.form;
        var upload = layui.upload;
        $ = layui.$;
        type =  $("#type").val()
        if(type == 1){
                $("#qiye").show();
                $("#qiye1").show();
                $("#qiye2").show();
                $("#geren").hide();
                $("#geren1").hide();
            }else{
                $("#qiye").hide();
                $("#qiye1").hide();
                $("#qiye2").hide();
                $("#geren").show();
                $("#geren1").show();
            }
        form.on('radio(levelM)', function(data){
          
            var level = data.value;//被点击的radio的value值
            //TODO 下面是我具体业务的处理代码，可忽略 ...
            if(level == 1){
                $("#qiye").show();
                $("#qiye1").show();
                $("#qiye2").show();
                $("#geren").hide();
                $("#geren1").hide();
            }else{
                $("#qiye").hide();
                $("#qiye1").hide();
                $("#qiye2").hide();
                $("#geren").show();
                $("#geren1").show();
            }
        });

    });
</script>